<include file="Public/head"/>
<link type="text/css" rel="stylesheet" href="{:get_style_cdnurl()}paimai/yunying/plugin/select2/select2.css" />
<script src="{:get_style_cdnurl()}paimai/yunying/plugin/select2/select2.js" type="text/javascript"></script>
<script src="http://img1.isou365.cn/paimai/yunying/js/city.js" type="text/javascript"></script>
<style>
    .xuanzhe ul li .menDao1{width:300px;}
    .xuanzhe ul li .menDao1 a{display:block;background:#cecece;color:#303030;float:left;width:36px; text-align:center;height:20px; line-height:20px; cursor:pointer;}
    .xuanzhe ul li .menDao1 .menHover{ background:#20ab4f;color:#fff;}
    .xuanzhe .lift-truck{width:280px;padding:10px;display:block; background:#e1e1e1;border-radius:5px;margin-left:60px;margin-top:-10px;}
    .xuanzhe .lift-truck #taker_phone,.xuanzhe .lift-truck #taker_sex,.xuanzhe .lift-truck #taker_card,.xuanzhe .lift-truck #take_car_num{width:280px; display:block;height:30px; line-height:30px; text-align:left;}
    .xuanzhe .lift-truck span em{float:left; display:block;width:60px; text-align:right;}
</style>
<include file="Public/common_header"/>
<div class="mian">
    <include file="Public/sidebar" menu="shgl.csyc"/>
    <div class="mianR">
        <div class="listBox">
            <h3 class="cha">车商验车详情</h3>
            <div class="car_info">
                <div class="car_no">
                    <span style="font-size:14px;">拍卖单号：<b>{$detail.order_no}</b></span>
                </div>
                <table border="1" width="100%">
                    <tbody>
                    <tr>
                        <td colspan="4" style="background-color:#c1c1c1;font-size:14px;"><span>车商信息</span></td>
                    </tr>
                    <tr>
                        <td width="11%" style="color:#898b8a;">车商联系人</td>
                        <td width="39%">{$detail.contact_person}</td>
                        <td width="11%" style="color:#898b8a;">联系人电话</td>
                        <td width="39%">{$detail.contact_mobile}</td>
                    </tr>
                    </tbody>
                </table>
                <table border="1" width="100%" style="margin-top:10px;">
                    <tbody>
                    <tr>
                        <td colspan="4" style="background-color:#c1c1c1;font-size:14px;">
                            <span>车辆信息</span>
                            <span style="float: right;margin-right: 20px;"><a style="color: #0000FF;text-decoration: underline;" href="/Car/report/car_id/{$detail.car_id}" target="_blank">检测报告</a></span>
                        </td>
                    </tr>
                    <tr>
                        <td width="11%" style="color:#898b8a;">车型</td>
                        <td width="39%">{$detail.model}</td>
                        <td width="11%" style="color:#898b8a;">排放标准</td>
                        <td width="39%">{$detail.emission}</td>
                    </tr>
                    <tr>
                        <td style="color:#898b8a;">初登日期</td>
                        <td>{$detail.first_reg_date}</td>
                        <td style="color:#898b8a;">颜色</td>
                        <td>{$detail.car_color}</td>
                    </tr>
                    <tr>
                        <td style="color:#898b8a;">表显里程</td>
                        <td>{$detail.pointer_mileage}万公里</td>
                        <td style="color:#898b8a;">车况级别</td>
                        <td>{$detail.composite_state}{$detail.accident_level}</td>
                    </tr>
                    <tr>
                        <td style="color:#898b8a;">车辆注册地</td>
                        <td>{$detail.reg_city}</td>
                        <td style="color:#898b8a;">车架号</td>
                        <td>{$detail.vin}</td>
                    </tr>
                    <tr>
                        <td style="color:#898b8a;">过户限制</td>
                        <td>{$transfer_type[$car_detail['transfer_limit']]}</td>
                        <td style="color:#898b8a;">车牌号</td>
                        <td>{$detail.plate_prefix}{$detail.plate_suffix}</td>
                    </tr>
                    <tr>
                        <td style="color:#898b8a;">渠道来源</td>
                        <td>
                            <if condition="$car_detail.comefrom neq ''">
                                <?php if(empty($car_detail['comefrom_url'])):?>
                                <?php echo $show_from[$car_detail['comefrom']];?>
                                <?php else: ?>
                                <a href="{$car_detail.comefrom_url}" target="_blank" rel="noreferrer"><?php echo $show_from[$car_detail['comefrom']];?></a>
                                <?php endif;?>
                                <else/>
                                未知
                            </if>
                        </td>
                        <td style="color:#898b8a;">所在地</td>
                        <td>{$detail.location_area_name}</td>
                    </tr>
                    </tbody>
                </table>
                <table border="1" width="100%" style="margin-top:10px;">
                    <tbody>
                    <tr>
                        <td colspan="4" style="background-color:#c1c1c1;font-size:14px;"><span>拍卖信息</span></td>
                    </tr>
                    <tr>
                        <td width="11%" style="color:#898b8a;">竞拍结束时间</td>
                        <td width="39%">{$detail.bidding_end_time}</td>
                        <td width="11%" style="color:#898b8a;">第一名出价</td>
                        <td width="39%">{:format_money($bestPrice)}元</td>
                    </tr>
                    <tr>
                        <td width="11%" style="color:#898b8a;">保留价</td>
                        <td width="39%">{$detail.format_reserve_price}元</td>
                        <?php if ($detail['is_consult'] == 1) { ?>
                          <td width="11%" style="color:#898b8a;">磋商成交价	</td>
                          <td width="39%">{:format_money($detail['success_price']+$detail['company_subsidies'])}元</td>
                        <?php } else { ?>
                          <td width="11%" style="color:#898b8a;">确认成交价</td>
                          <td width="39%">{:format_money($detail['success_price'])}元</td>
                    </tr>
                        <?php } ?>
                    <tr>
                        <td>公司补贴</td>
                        <td>{$detail.company_subsidies}元</td>
                    </tr>
                    </tbody>
                </table>
                <!--评估师信息-->
                <table border="1" width="100%" style="margin-top:10px;">
                    <tbody>
                        <tr>
                            <td colspan="4" style="background-color:#c1c1c1;font-size:14px;"><span>评估师信息</span></td>
                        </tr>
                        <tr>
                            <td width="11%" style="color:#898b8a;">评估师姓名</td>
                            <td width="39%">{$detail.checker_name}</td>
                            <td width="11%" style="color:#898b8a;">评估师电话</td>
                            <td width="39%">{$detail.checker_mobile}</td>
                        </tr>
                    </tbody>
                </table>
                <!--代驾信息-->
                <?php if (isset($detail['car_source']) && $detail['car_source'] == 1) { ?>
                <table border="1" width="100%" style="margin-top:10px;">
                    <tbody>
                    <tr>
                        <td colspan="4" style="background-color:#c1c1c1;font-size:14px;"><span>代驾信息</span></td>
                    </tr>
                    <tr>
                        <td width="11%" style="color:#898b8a;">代驾姓名</td>
                        <td width="39%">{$detail.driver_name}</td>
                        <td width="11%" style="color:#898b8a;">代驾公司</td>
                        <td width="39%">{$detail.driver_company}</td>
                    </tr>
                    <tr>
                        <td width="11%" style="color:#898b8a;">代驾电话</td>
                        <td width="39%">{$detail.driver_phone}</td>
                        <td width="11%" style="color:#898b8a;">代驾出发时间</td>
                        <td width="39%">
                            <?php if(!empty($detail['depart_time']) && $detail['depart_time'] > 0) { ?>
                            {$detail.depart_time|strtotime|date='Y-m-d H:i',###}
                            <?php } ?>
                        </td>
                    </tr>
                    </tbody>
                </table>
                <?php } ?>
                <!--复检信息-->
                <table border="1" width="100%" style="margin-top:10px;">
                    <tbody>
                    <tr>
                        <td colspan="4" style="background-color:#c1c1c1;font-size:14px;"><span>复检信息</span></td>
                    </tr>
                    <tr>
                        <td width="11%" style="color:#898b8a;">手续复检员</td>
                        <td width="39%">{$detail.procedure_checker_name}</td>
                        <td width="11%" style="color:#898b8a;">车况复检员</td>
                        <td width="39%">{$detail.condition_checker_name}</td>
                    </tr>
                    <tr>
                        <td width="11%" style="color:#898b8a;">复检时间</td>
                        <td width="39%">
                            <?php if(!empty($detail['recheck_time'])){ echo date('Y-m-d H:i', strtotime($detail['recheck_time'])); } ?>
                        </td>
                        <td width="11%" style="color:#898b8a;">核实手续</td>
                        <td width="39%">
                            {$detail.procedures}
                        </td>
                    </tr>
                    <tr>
                        <td width="11%" style="color:#898b8a;">复检备注</td>
                        <td width="39%" colspan="3">{$detail.recheck_remark}</td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>

        <?php if($detail['status'] > 0):?>
            <h3 class="yonghu">系统跟踪日志</h3>
            <div class="yonghuText">
                <ul>
                    <volist name="carCheckLogList" id="list" key="k">
                        <li class="{$k%2==0?'xitongBg':''} clearfix">
                            <em class="huShi">{$list.create_at}</em>
                            <em>{$list.emp_name}</em>
                            <em>{$list.action}</em>
                            <em class="huShi">{$list.remark}</em>
                        </li>
                    </volist>
                </ul>
            </div>
        <?php endif;?>
        <if condition="$detail['status'] gt 0 ">
            <h3 class="yonghu">选择验车结果</h3>
            <div class="yuyue">
                <ul>
                    <li class="yuCurrent">继续跟踪</li>
                    <li >验车完成</li>
                </ul>
            </div>
            <div class="listBox">
                <input type="hidden" id="check_id" name="check_id"  value="{$detail['check_id']}"/>
                <div class="yuList">

                    <div class="xuanzhe">
                        <ul>
                            <li class="clearfix">
                                <span>下次跟踪时间</span>
                                <input type="text" name="check_time" id="next_trace_time" class="check_time_1" placeholder="请选择下次跟踪时间" value="" maxlength="10" readonly /><em style="color:red;">&nbsp;*</em>
                            </li>
                            <li class="clearfix remarks">
                                <span>跟踪原因</span>
                                <textarea name="trace_reason"></textarea>
                            </li>
                        </ul>
                    </div>
                    <div class="yongBtn">
                        <input type="hidden" name="re_auction_type" value="{$re_auction_type}" />
                        <input type="hidden" name="first_money" value="{$first_money}" />
                        <input type="submit" value="确定" class="queding trace"/>
                        <input class="quxiao" type="submit" value="返回" onclick="history.back();">
                    </div>
                </div>

                <div class="yuList" style="display: none;">
                    <div class="xuanzhe">
                        <ul>
                            <li class="clearfix">
                                <span>验车时间</span>
                                <input type="text" name="check_time" id="check_time_1" class="check_time_1" placeholder="请选择时间" value="" maxlength="10" readonly /><em style="color:red;">&nbsp;*</em>
                            </li>
                            <?php if($detail['level']==1 && $detail['transfer_type']==1):?>
                            <li class="clearfix" style="height:35px;">
                                <span>提车人</span>
                                <em class="transfer-text">
                                    <select id="take_car_man" name="take_car_man" style="width:150px;">
                                        <option value="0" cardid="" sexid="" takenum="" mobile="">请选择提车人</option>
                                        <?php foreach($take_men as $k=>$man):?>
                                        <option cardid="{$man.idcard}" sexid="{$man.sex}"  takenum="{$man.take_num}" mobile="{$man.mobile}" value="{$man.man_id}">{$man.real_name}</option>
                                        <?php endforeach;?>
                                    </select>
                                </em>
                            </li>
                            <li class="clearfix lift-truck">
                                <span style='' id = "taker_phone"><em>手机：</em></span><br/>
                                <span style='' id = "taker_card"><em>身份证：</em><span></span></span><br/>
                                <span style='' id = "take_car_num"><em>提车数量：</em></span>
                            </li>
                            <?php endif;?>
                            <li class="clearfix remarks">
                                <span>备注</span><textarea name="reserve_remark"></textarea>
                            </li>
                        </ul>
                    </div>
                    <div class="yongBtn">
                        <input type="hidden" name="re_auction_type" value="{$re_auction_type}" />
                        <input type="hidden" name="first_money" value="{$first_money}" />
                        <input type="submit" value="确定" class="queding consultpay"/>
                        <input class="quxiao" type="submit" value="返回" onclick="history.back();">
                    </div>
                </div>

            </div>
        </if>

    </div>
    <div class="clear"></div>
</div>
<script>
    $("input[name=check_time]").ymdateplugin({
        showTimePanel: true,
        changeMonth: true,
        changeYear: true
    });

    $("#next_trace_time").ymdateplugin({
        showTimePanel: true,
        changeMonth: true,
        changeYear: true
    });

//    function ghyq(type_val) {
//        $('#service_method').val(type_val);
//        if (type_val == 1) {
//            $('#input_ticheren_list,#input_ticheren_info').show();
//        } else {
//            $('#input_ticheren_list,#input_ticheren_info').hide();
//        }
//    }
    $(function () {
        $("#take_car_man").select2();
    });
    $("#take_car_man").change(function(){
        var idcard = $(this).find("option:selected").attr("cardid");
        var sex_id = $(this).find("option:selected").attr("sexid");
        var take_num = $(this).find("option:selected").attr("takenum");
        var mobile = $(this).find("option:selected").attr("mobile");
        if (sex_id ==1) {
            var sexstr ="男";
        }else if(sex_id ==2)
        {
            var sexstr ="女";
        }else{
            var sexstr ="";
        }
        $("#taker_phone").html("<em>手机：</em>"+mobile);
        $("#taker_sex").html("<em>性别：</em>"+sexstr);
        $("#taker_card").html("<em>身份证：</em>"+idcard);
        $("#take_car_num").html("<em>提车数量：</em>"+take_num);
    })

    $('.consultpay').click(function () {
        var dealer_id = '{$detail.dealer_id}';
        var order_id = '{$detail.order_id}';
        var check_id = '{$detail.check_id}';
        var car_id = '{$detail.car_id}';
        if (order_id == '') {
            shibai_alert('缺少必要参数，请联系管理员');
            return;
        }
        var owner_id = '{$detail.owner_id}';
        if (owner_id == '') {
            shibai_alert('缺少必要参数，请联系管理员');
            return;
        }
        var check_time = $('#check_time_1').val();
        if (check_time == '' || check_time < 0) {
            shibai_alert('请选择验车时间！');
            return;
        }
        var check_time = $('#check_time_1').val();
        var reserve_remark = $.trim($('textarea[name=reserve_remark]').val());
        $(".yunBei").css("display","block").unbind('click')
        $(".loading").fadeIn();
        do_consult_pay();
        function do_consult_pay() {
            var param = {
                'check_id': check_id,
                'order_id': order_id,
                'owner_id': owner_id,
                'car_id': car_id,
                'check_time': check_time,
                'pay_remark': reserve_remark
            };
            $.post('/DealerCheckCar/doConsultPay', param, function (data) {
                if (data.code == '200') {
                    btn_alert(data.msg, 2000, function () {
                        window.location.href = document.referrer;
                    });
                } else {
                    $(".loading").fadeOut();
                    $(".yunBei").css("display","none")
                    shibai_alert(data.msg);
                    return false;
                }
            }, 'json')
        }
    });

    $('.trace').click(function () {
        var order_id = '{$detail.order_id}';
        var check_id = '{$detail.check_id}';
        var dealer_id = '{$detail.dealer_id}';
        var car_id = '{$detail.car_id}';
        if (order_id == '') {
            shibai_alert('缺少必要参数，请联系管理员');
            return;
        }
        var owner_id = '{$detail.owner_id}';
        if (owner_id == '') {
            shibai_alert('缺少必要参数，请联系管理员');
            return;
        }
        var next_trace_time = $('#next_trace_time').val();
        if (next_trace_time == '' || next_trace_time < 0) {
            shibai_alert('请选择下次跟踪时间！');
            return;
        }
        var trace_reason = $.trim($('textarea[name=trace_reason]').val());
        if (trace_reason == '') {
            shibai_alert('请填写跟踪原因！');
            return;
        }
        $(".yunBei").css("display","block").unbind('click')
        $(".loading").fadeIn();
        trace();
        function trace() {
            var param = {
                'check_id': check_id,
                'order_id': order_id,
                'owner_id': owner_id,
                'dealer_id': dealer_id,
                'car_id': car_id,
                'next_trace_time': next_trace_time,
                'trace_reason': trace_reason
            };
            $.post('/DealerCheckCar/doContinueTrace', param, function (data) {
                if (data.code == '200') {
                    btn_alert(data.msg, 2000, function () {
                        window.location.href = document.referrer;
                    });
                } else {
                    $(".loading").fadeOut();
                    $(".yunBei").css("display","none")
                    shibai_alert(data.msg);
                    return false;
                }
            }, 'json');
        }
    });

</script>
<include file="Public/foot" />